<?php

namespace App\Exports;

use Maatwebsite\Excel\Concerns\FromView;
use Illuminate\Contracts\View\View;
use App\Http\Models\Report\ReportRegionKeyProduct;

class ReportRegionKeyProductExport implements FromView
{
    public function view(): View
    {
        $year = is_numeric(request()->year) ? request()->year : date('Y', time());
        $report_region_key_product = new ReportRegionKeyProduct($year);

        return view('report.region_key_product_progress.table', [
            'year' => $year,
            'report_region_key_product' => $report_region_key_product,
        ]);
    }
}
